package com.ushio.gougouwangguo.utils.multithreading;

import com.alibaba.excel.EasyExcel;
import com.ushio.gougouwangguo.entity.mysql.Person;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MillionLevelExport implements Runnable{


    private final List<Person> personList;

    public MillionLevelExport(List<Person> personList){
        this.personList = personList;
    }

    @Override
    public void run() {

        String fileName = "million_persons.xlsx";


            // 分批追加写入
            EasyExcel.write(fileName, Person.class)
                    .sheet("人员数据")
                    .doWrite(personList);

        System.out.println("百万数据已生成到本地 Excel：" + fileName);
    }
}
